package com.yzh.ios2;

import java.io.*;

/**
 * @author 于振晗
 * @title: FileTest3
 * @description: TODO 文件复制
 * @date 2020年09月07日
 * @path com.yzh.file
 */
public class CopyFileTest1 {
    public static void main(String[] args) {
        try(InputStream ips = new FileInputStream("D:/sxtjava/test1.txt");
            OutputStream ops = new FileOutputStream("D:/sxtjava/test2.txt")) {
            byte [] buf = new byte[1024];
            int len = 0;
            while (len!=-1){
                len = ips.read(buf);
                ops.write(buf,0,len);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
